import $axios from '@/utils/axios'

export default {
  
  getList(params?: object): Promise<CommonObjectType<string>> {
    return $axios.get('dm/api/sys/user/list', params)
  },
  //获取部门下人员
  getListByOrg(params?: object): Promise<CommonObjectType<string>> {
    return $axios.post('dm/api/sys/user/children-user-list', params)
  },
  //新增用户
  userAdd(params?: object): Promise<CommonObjectType<string>> {
    return $axios.post('dm/api/sys/user/add', params)
  },
  //删除用户
  userDel(params?: object): Promise<CommonObjectType<string>> {
    return $axios.delete('dm/api/sys/user/del', params)
  },
  //编辑用户
  userEdit(params?: object): Promise<CommonObjectType<string>> {
    return $axios.put('dm/api/sys/user/edit', params)
  },
  //用户详情
  userDetail(params?: object): Promise<CommonObjectType<string>> {
    return $axios.get('dm/api/sys/user/detail', params)
  },
  //分配角色
  userGrant(params?: object): Promise<CommonObjectType<string>> {
    return $axios.post('dm/api/sys/user/grant', params)
  },
  //删除角色
  userGrantDel(params?: object): Promise<CommonObjectType<string>> {
    return $axios.delete('dm/api/sys/user/remove-grant', params)
  },
  //用户信息
  currentUser(params?: object): Promise<CommonObjectType<string>> {
    return $axios.get('dm/api/sys/user/getUserByToken', params)
  },
}
